package iot.wlink;

import iot.wlink.network.protocols.NetworkComponentStater;
import iot.wlink.network.protocols.mqtt.MqttDeviceAuthenticationHandler;
import iot.wlink.network.protocols.mqtt.MqttDeviceManager;
import iot.wlink.network.protocols.mqtt.MqttIotServerComponent;
import iot.wlink.utils.BeanUtil;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author : willian fu
 * @date : 2021/8/21
 */
@MapperScan(basePackages = "iot.wlink.mapper")
@SpringBootApplication
public class WlinkIotStater implements CommandLineRunner {

    @Autowired
    private MqttIotServerComponent mqttIotServerComponent;

    public static void main(String[] args) {
        SpringApplication.run(WlinkIotStater.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        NetworkComponentStater.INSTANCE
                .regServer(mqttIotServerComponent)
                //.regServer(new TcpIotServerComponent())
                .initAll().stater();
    }
}
